const MARITAL_STATUS_LIST = [
	{
		name: '未婚',
		value: 1,
	},
	{
		name: '离异',
		value: 2,
	},
	{
		name: '丧偶',
		value: 3,
	}
]


export const getMaritalStatusList = ({ hasEmpty = true } = {}) => {
  const	carList = [...MARITAL_STATUS_LIST];
  if (hasEmpty) {
    carList.unshift({
			name: '不限',
			value: null,
		})
  }

  return carList
}

export const getMaritalStatusByIndex = ({ hasEmpty = true, index } = {}) => {
	if (!Number.isInteger(index)) {
		return {
			name: "",
			value: null
		}
	}

  const carList = getMaritalStatusList({ hasEmpty });

	const value = carList[index];
	return value
}

export const getMaritalStatusTextByValue = ({ hasEmpty = true, value } = {}) => {
	const carList = getMaritalStatusList({ hasEmpty });
	const car = carList.find(item => item.value === value)

	if (!car) {
		return ""
	}

	return car.name
}

export const getMaritalStatusByValue = ({ value } = {}) => {
	return MARITAL_STATUS_LIST.find(item => item.value === value) || {}
}